package cn.yuanqiao.archive.management.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 下载记录对象 YqXzjl
 *
 * @author sy
 * @date 2023-12-19
 */
public class YqXzjl extends BaseEntity {
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQXZJL";

    public YqXzjl() {
        String userCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(userCode)){
            throw new ServiceException("TenantCode is null");
//            this.tableName = "YQXZJL";
        }else {
            this.tableName = userCode.toUpperCase()+BIGTABLENAME;
//            this.tableName = "YQXZJL";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /**  */
    @IdAnnotation
    private Long id;

    /** 载体ID */
    @Excel(name = "载体ID")
    private Long ztId;

    /** 盘规格表ID */
    @Excel(name = "盘规格表ID")
    private Long pggId;

    /** 盘规格表组盘名称 */
    @Excel(name = "组盘名称")
    private String pggName;

    /** 盘号 */
    @Excel(name = "盘号")
    private String ph;

    /** 组盘规则ID */
    @Excel(name = "组盘规则ID")
    private Long zpgzId;

    /** 组盘记录ID */
    private Long zpjlId;

    /** 下载到的路径 */
    private String filePath;

    /** 文件名称 */
    private String fileName;

    /** 文件大小 */
    private String fileSize;

    /** 创建人 */
    @Excel(name = "创建人")
    private Long creatorId;

    /** 创建时间 */
    @JsonFormat(pattern ="yyyy-MM-dd")
    private Date createTime;

    private String beginTime;

    private String endTime;

    public String getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(String beginTime) {
        this.beginTime = beginTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getZtId() {
        return ztId;
    }

    public void setZtId(Long ztId) {
        this.ztId = ztId;
    }

    public Long getPggId() {
        return pggId;
    }

    public void setPggId(Long pggId) {
        this.pggId = pggId;
    }

    public String getPggName() {
        return pggName;
    }

    public void setPggName(String pggName) {
        this.pggName = pggName;
    }

    public String getPh() {
        return ph;
    }

    public void setPh(String ph) {
        this.ph = ph;
    }

    public Long getZpgzId() {
        return zpgzId;
    }

    public void setZpgzId(Long zpgzId) {
        this.zpgzId = zpgzId;
    }

    public Long getZpjlId() {
        return zpjlId;
    }

    public void setZpjlId(Long zpjlId) {
        this.zpjlId = zpjlId;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFileSize() {
        return fileSize;
    }

    public void setFileSize(String fileSize) {
        this.fileSize = fileSize;
    }

    public Long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Long creatorId) {
        this.creatorId = creatorId;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("ztId", getZtId())
                .append("pggId", getPggId())
                .append("zpgzId", getZpgzId())
                .append("pggName", getPggName())
                .append("zpjlId", getZpjlId())
                .append("filePath", getFilePath())
                .append("fileSize", getFileSize())
                .append("creatorId", getCreatorId())
                .append("createTime", getCreateTime())
                .append("fileName", getFileName())
                .append("id", getId())
                .append("ph", getPh())
                .toString();
    }
}
